package concurrent;

public class SyncTest {


    public synchronized String test1(String s){
        System.out.println(s);
        return s;
    }


    public String test2(String s){
        System.out.println(s);
        return s;
    }


    public static void main(String[] args) {
        SyncTest syncTest = new SyncTest();
        new Thread(()->{
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            syncTest.test1("test1");
        }).start();

        syncTest.test1("test1-2");
        syncTest.test2("test2");

    }

}
